<?php
namespace App\Model;
use PhalApi\Model\NotORMModel as NotORM;

class Auth extends NotORM {
   

    /* 获取实名认证信息 */   	
    public function getUserAuthInfo($uid) {

		$info=\PhalApi\DI()->notorm->user_auth
				->select('*')
				->where('uid=?',$uid)
				->fetchOne();
        if ($info && $info['name'] == 'user') {
            $info['name'] = '';
        }
        return $info;
    }

    //获取主播认证信息
    public function getAuthorAuthInfo($uid){
    	$info=\PhalApi\DI()->notorm->author_auth
				->select('*')
				->where('uid=?',$uid)
				->fetchOne();
        return $info;
    }

    public function setUserAuth($data){
    	$rs=\PhalApi\DI()->notorm->user_auth
				->insert($data);
                
		return $rs;
    }

    /* 更新认证 */
    public function upUserAuth($uid,$data) {
        
        $rs=\PhalApi\DI()->notorm->user_auth
				->where('uid=?',$uid)
				->update($data);
                
		return $rs;
    }

    public function setAuthorAuth($data){
    	$rs=\PhalApi\DI()->notorm->author_auth
				->insert($data);
                
		return $rs;
    }

    public function upAuthorAuth($uid,$data){
    	$rs=\PhalApi\DI()->notorm->author_auth
				->where('uid=?',$uid)
				->update($data);
                
		return $rs;
    }

}
